package com.liukuan.netty.bio2;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

/**
 * Created by liukuan on 16/3/30.
 */
public class GetTimeThreadPoolHandler {

	private ExecutorService executor;

	public GetTimeThreadPoolHandler(int maxpoolsize, int queuqsize) {
		ArrayBlockingQueue<Runnable> queue = new ArrayBlockingQueue<Runnable>(queuqsize);
		executor = new ThreadPoolExecutor(Runtime.getRuntime().availableProcessors(), maxpoolsize, 120L, TimeUnit.SECONDS, queue);
	}
	
	public void execute(Runnable task){
		executor.execute(task);
	}
	

}
